W=256:H=320:FN$="Sprites"
'---------------------------------
'mode 1
load png FN$+".png"
for y=0 to h
for x=0 to w 
cl%=0
n=Pixel(x,y)AND &HFFFFFF
r=n AND &HFF
if r>96 and r<128 then
 if (y mod 2)then 
 R=255*(x mod 2)
 else
 R=255*not (x mod 2)
 endif 
end if
inc cl%,255*(r>127):n=int(n/256)

g=n AND &HFF
select case g
case >191 
inc cl%,&HFF00
goto weiter
case >127
inc cl%,&H8000
goto weiter
case >63
inc cl%,&H4000
end select
weiter:
n=int(n/256)
b=n AND &HFF:inc cl%,&Hff0000*(b>64)
pixel x,y,cl%
next: next
save image FN$+".bmp",0,0,w,h
